<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LINE 1 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-1"></span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LINE 2 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE Safe #-}</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-pragma">{-# LINE 6 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-6"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- Module      :  Graphics.Win32.Menu</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Copyright   :  (c) Alastair Reid, 1997-2003</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- License     :  BSD-style (see the file libraries/base/LICENSE)</span><span>
</span><span id="line-11"></span><span class="hs-comment">--</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Maintainer  :  Esa Ilari Vuokko &lt;ei@vuokko.info&gt;</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Stability   :  provisional</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-15"></span><span class="hs-comment">--</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- A collection of FFI declarations for interfacing with Win32.</span><span>
</span><span id="line-17"></span><span class="hs-comment">--</span><span>
</span><span id="line-18"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Graphics.Win32.Menu</span><span>
</span><span id="line-21"></span><span class="hs-comment">{-
       (
         MenuName
       , checkMenuItem
       , checkMenuRadioItem
       , createMenu
       , createPopupMenu
       , deleteMenu
       , destroyMenu
       , drawMenuBar
       , enableMenuItem
       , getMenu
       , getMenuDefaultItem
       , getMenuItemCount
       , getMenuItemID
       , getMenuItemInfo
       , getMenuItemRect
       , getMenuState
       , getSubMenu
       , getSystemMenu
       , hiliteMenuItem
       , insertMenuItem
       , isMenu
       , loadMenu
       , menuItemFromPoint
       , setMenu
       , setMenuDefaultItem
       , setMenuItemBitmaps
       , setMenuItemInfo
       , trackPopupMenu
       , trackPopupMenuEx

       , GMDIFlag
       , MenuItem
       , MenuFlag
       , MenuState
       , TrackMenuFlag
       , SystemMenuCommand

         -- Obsolete:
       , appendMenu
       , insertMenu
       , modifyMenu
       , removeMenu

       ) -}</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-67"></span><span>
</span><span id="line-68"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Graphics.Win32.GDI.Types</span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Types</span><span>
</span><span id="line-70"></span><span>
</span><span id="line-71"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign</span><span>
</span><span id="line-72"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control.Monad</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">liftM</span><span class="hs-special">)</span><span class="hs-cpp">

#include &quot;windows_cconv.h&quot;
</span><span>
</span><span id="line-76"></span><span>
</span><span id="line-77"></span><span>
</span><span id="line-78"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">MenuName</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">LPCTSTR</span><span>
</span><span id="line-79"></span><span>
</span><span id="line-80"></span><span class="hs-identifier">checkMenuItem</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-81"></span><span class="hs-identifier">checkMenuItem</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">check</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-82"></span><span>  </span><span class="hs-identifier">rv</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">failIf</span><span> </span><span class="hs-special">(</span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">maxBound</span><span class="hs-special">)</span><span> </span><span class="hs-string">&quot;CheckMenuItem&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_CheckMenuItem</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">check</span><span>
</span><span id="line-83"></span><span>  </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">rv</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">mF_CHECKED</span><span class="hs-special">)</span><span>
</span><span id="line-84"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h CheckMenuItem&quot;</span><span>
</span><span id="line-85"></span><span>  </span><span class="hs-identifier">c_CheckMenuItem</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span class="hs-identifier">checkMenuRadioItem</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-88"></span><span class="hs-identifier">checkMenuRadioItem</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">first_id</span><span> </span><span class="hs-identifier">last_id</span><span> </span><span class="hs-identifier">check</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-89"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;CheckMenuRadioItem&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-90"></span><span>    </span><span class="hs-identifier">c_CheckMenuRadioItem</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">first_id</span><span> </span><span class="hs-identifier">last_id</span><span> </span><span class="hs-identifier">check</span><span> </span><span class="hs-identifier">flags</span><span>
</span><span id="line-91"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h CheckMenuRadioItem&quot;</span><span>
</span><span id="line-92"></span><span>  </span><span class="hs-identifier">c_CheckMenuRadioItem</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-93"></span><span>
</span><span id="line-94"></span><span class="hs-identifier">createMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HMENU</span><span>
</span><span id="line-95"></span><span class="hs-identifier">createMenu</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-96"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-string">&quot;CreateMenu&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_CreateMenu</span><span>
</span><span id="line-97"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h CreateMenu&quot;</span><span>
</span><span id="line-98"></span><span>  </span><span class="hs-identifier">c_CreateMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HMENU</span><span>
</span><span id="line-99"></span><span>
</span><span id="line-100"></span><span class="hs-identifier">createPopupMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HMENU</span><span>
</span><span id="line-101"></span><span class="hs-identifier">createPopupMenu</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-102"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-string">&quot;CreatePopupMenu&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_CreatePopupMenu</span><span>
</span><span id="line-103"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h CreatePopupMenu&quot;</span><span>
</span><span id="line-104"></span><span>  </span><span class="hs-identifier">c_CreatePopupMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HMENU</span><span>
</span><span id="line-105"></span><span>
</span><span id="line-106"></span><span class="hs-identifier">drawMenuBar</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-107"></span><span class="hs-identifier">drawMenuBar</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-108"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;DrawMenuBar&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_DrawMenuBar</span><span> </span><span class="hs-identifier">wnd</span><span>
</span><span id="line-109"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h DrawMenuBar&quot;</span><span>
</span><span id="line-110"></span><span>  </span><span class="hs-identifier">c_DrawMenuBar</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-111"></span><span>
</span><span id="line-112"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">MenuState</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">MenuFlag</span><span>
</span><span id="line-113"></span><span>
</span><span id="line-114"></span><span class="hs-identifier">enableMenuItem</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">MenuState</span><span>
</span><span id="line-115"></span><span class="hs-identifier">enableMenuItem</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">flag</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-116"></span><span>  </span><span class="hs-identifier">failIf</span><span> </span><span class="hs-special">(</span><span class="hs-operator">==</span><span> </span><span class="hs-number">0xffffffff</span><span class="hs-special">)</span><span> </span><span class="hs-string">&quot;EnableMenuItem&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_EnableMenuItem</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">flag</span><span>
</span><span id="line-117"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h EnableMenuItem&quot;</span><span>
</span><span id="line-118"></span><span>  </span><span class="hs-identifier">c_EnableMenuItem</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">MenuState</span><span>
</span><span id="line-119"></span><span>
</span><span id="line-120"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">GMDIFlag</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-121"></span><span>
</span><span id="line-122"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">MenuFlag</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-123"></span><span>
</span><span id="line-124"></span><span class="hs-identifier">gMDI_USEDISABLED</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GMDIFlag</span><span>
</span><span id="line-125"></span><span class="hs-identifier">gMDI_USEDISABLED</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-126"></span><span class="hs-identifier">gMDI_GOINTOPOPUPS</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GMDIFlag</span><span>
</span><span id="line-127"></span><span class="hs-identifier">gMDI_GOINTOPOPUPS</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-128"></span><span>
</span><span id="line-129"></span><span class="hs-pragma">{-# LINE 128 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-128"></span><span>
</span><span id="line-129"></span><span class="hs-identifier">mF_BYCOMMAND</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuFlag</span><span>
</span><span id="line-130"></span><span class="hs-identifier">mF_BYCOMMAND</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-131"></span><span class="hs-identifier">mF_BYPOSITION</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuFlag</span><span>
</span><span id="line-132"></span><span class="hs-identifier">mF_BYPOSITION</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1024</span><span>
</span><span id="line-133"></span><span class="hs-identifier">mF_CHECKED</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuFlag</span><span>
</span><span id="line-134"></span><span class="hs-identifier">mF_CHECKED</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8</span><span>
</span><span id="line-135"></span><span>
</span><span id="line-136"></span><span class="hs-pragma">{-# LINE 134 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-134"></span><span>
</span><span id="line-135"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-136"></span><span>
</span><span id="line-137"></span><span class="hs-identifier">mF_INSERT</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItem</span><span>
</span><span id="line-138"></span><span class="hs-identifier">mF_INSERT</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-139"></span><span class="hs-identifier">mF_CHANGE</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItem</span><span>
</span><span id="line-140"></span><span class="hs-identifier">mF_CHANGE</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">128</span><span>
</span><span id="line-141"></span><span class="hs-identifier">mF_APPEND</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItem</span><span>
</span><span id="line-142"></span><span class="hs-identifier">mF_APPEND</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">256</span><span>
</span><span id="line-143"></span><span class="hs-identifier">mF_DELETE</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItem</span><span>
</span><span id="line-144"></span><span class="hs-identifier">mF_DELETE</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">512</span><span>
</span><span id="line-145"></span><span class="hs-identifier">mF_REMOVE</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItem</span><span>
</span><span id="line-146"></span><span class="hs-identifier">mF_REMOVE</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4096</span><span>
</span><span id="line-147"></span><span class="hs-identifier">mF_USECHECKBITMAPS</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItem</span><span>
</span><span id="line-148"></span><span class="hs-identifier">mF_USECHECKBITMAPS</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">512</span><span>
</span><span id="line-149"></span><span class="hs-identifier">mF_POPUP</span><span>              </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItem</span><span>
</span><span id="line-150"></span><span class="hs-identifier">mF_POPUP</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16</span><span>
</span><span id="line-151"></span><span class="hs-identifier">mF_SYSMENU</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItem</span><span>
</span><span id="line-152"></span><span class="hs-identifier">mF_SYSMENU</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8192</span><span>
</span><span id="line-153"></span><span class="hs-identifier">mF_HELP</span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItem</span><span>
</span><span id="line-154"></span><span class="hs-identifier">mF_HELP</span><span>               </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16384</span><span>
</span><span id="line-155"></span><span class="hs-identifier">mF_MOUSESELECT</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItem</span><span>
</span><span id="line-156"></span><span class="hs-identifier">mF_MOUSESELECT</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">32768</span><span>
</span><span id="line-157"></span><span class="hs-identifier">mF_END</span><span>                </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItem</span><span>
</span><span id="line-158"></span><span class="hs-identifier">mF_END</span><span>                </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">128</span><span>
</span><span id="line-159"></span><span>
</span><span id="line-160"></span><span class="hs-pragma">{-# LINE 150 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-150"></span><span>
</span><span id="line-151"></span><span class="hs-identifier">mFT_STRING</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuFlag</span><span>
</span><span id="line-152"></span><span class="hs-identifier">mFT_STRING</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-153"></span><span class="hs-identifier">mFT_BITMAP</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuFlag</span><span>
</span><span id="line-154"></span><span class="hs-identifier">mFT_BITMAP</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-155"></span><span class="hs-identifier">mFT_MENUBARBREAK</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuFlag</span><span>
</span><span id="line-156"></span><span class="hs-identifier">mFT_MENUBARBREAK</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">32</span><span>
</span><span id="line-157"></span><span class="hs-identifier">mFT_MENUBREAK</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuFlag</span><span>
</span><span id="line-158"></span><span class="hs-identifier">mFT_MENUBREAK</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">64</span><span>
</span><span id="line-159"></span><span class="hs-identifier">mFT_OWNERDRAW</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuFlag</span><span>
</span><span id="line-160"></span><span class="hs-identifier">mFT_OWNERDRAW</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">256</span><span>
</span><span id="line-161"></span><span class="hs-identifier">mFT_RADIOCHECK</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuFlag</span><span>
</span><span id="line-162"></span><span class="hs-identifier">mFT_RADIOCHECK</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">512</span><span>
</span><span id="line-163"></span><span class="hs-identifier">mFT_SEPARATOR</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuFlag</span><span>
</span><span id="line-164"></span><span class="hs-identifier">mFT_SEPARATOR</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2048</span><span>
</span><span id="line-165"></span><span class="hs-identifier">mFT_RIGHTORDER</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuFlag</span><span>
</span><span id="line-166"></span><span class="hs-identifier">mFT_RIGHTORDER</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8192</span><span>
</span><span id="line-167"></span><span class="hs-identifier">mFT_RIGHTJUSTIFY</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuFlag</span><span>
</span><span id="line-168"></span><span class="hs-identifier">mFT_RIGHTJUSTIFY</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16384</span><span>
</span><span id="line-169"></span><span>
</span><span id="line-170"></span><span class="hs-pragma">{-# LINE 162 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span>
</span><span id="line-164"></span><span class="hs-identifier">mFS_GRAYED</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuState</span><span>
</span><span id="line-165"></span><span class="hs-identifier">mFS_GRAYED</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">3</span><span>
</span><span id="line-166"></span><span class="hs-identifier">mFS_DISABLED</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuState</span><span>
</span><span id="line-167"></span><span class="hs-identifier">mFS_DISABLED</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">3</span><span>
</span><span id="line-168"></span><span class="hs-identifier">mFS_CHECKED</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuState</span><span>
</span><span id="line-169"></span><span class="hs-identifier">mFS_CHECKED</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8</span><span>
</span><span id="line-170"></span><span class="hs-identifier">mFS_HILITE</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuState</span><span>
</span><span id="line-171"></span><span class="hs-identifier">mFS_HILITE</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">128</span><span>
</span><span id="line-172"></span><span class="hs-identifier">mFS_ENABLED</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuState</span><span>
</span><span id="line-173"></span><span class="hs-identifier">mFS_ENABLED</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-174"></span><span class="hs-identifier">mFS_UNCHECKED</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuState</span><span>
</span><span id="line-175"></span><span class="hs-identifier">mFS_UNCHECKED</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-176"></span><span class="hs-identifier">mFS_UNHILITE</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuState</span><span>
</span><span id="line-177"></span><span class="hs-identifier">mFS_UNHILITE</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-178"></span><span class="hs-identifier">mFS_DEFAULT</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuState</span><span>
</span><span id="line-179"></span><span class="hs-identifier">mFS_DEFAULT</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4096</span><span>
</span><span id="line-180"></span><span>
</span><span id="line-181"></span><span class="hs-pragma">{-# LINE 174 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-174"></span><span>
</span><span id="line-175"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-176"></span><span>
</span><span id="line-177"></span><span class="hs-identifier">tPM_LEFTBUTTON</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span>
</span><span id="line-178"></span><span class="hs-identifier">tPM_LEFTBUTTON</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-179"></span><span class="hs-identifier">tPM_RIGHTBUTTON</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span>
</span><span id="line-180"></span><span class="hs-identifier">tPM_RIGHTBUTTON</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-181"></span><span class="hs-identifier">tPM_LEFTALIGN</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span>
</span><span id="line-182"></span><span class="hs-identifier">tPM_LEFTALIGN</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-183"></span><span class="hs-identifier">tPM_CENTERALIGN</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span>
</span><span id="line-184"></span><span class="hs-identifier">tPM_CENTERALIGN</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-185"></span><span class="hs-identifier">tPM_RIGHTALIGN</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span>
</span><span id="line-186"></span><span class="hs-identifier">tPM_RIGHTALIGN</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8</span><span>
</span><span id="line-187"></span><span class="hs-identifier">tPM_TOPALIGN</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span>
</span><span id="line-188"></span><span class="hs-identifier">tPM_TOPALIGN</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-189"></span><span class="hs-identifier">tPM_VCENTERALIGN</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span>
</span><span id="line-190"></span><span class="hs-identifier">tPM_VCENTERALIGN</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16</span><span>
</span><span id="line-191"></span><span class="hs-identifier">tPM_BOTTOMALIGN</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span>
</span><span id="line-192"></span><span class="hs-identifier">tPM_BOTTOMALIGN</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">32</span><span>
</span><span id="line-193"></span><span class="hs-identifier">tPM_HORIZONTAL</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span>
</span><span id="line-194"></span><span class="hs-identifier">tPM_HORIZONTAL</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-195"></span><span class="hs-identifier">tPM_VERTICAL</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span>
</span><span id="line-196"></span><span class="hs-identifier">tPM_VERTICAL</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">64</span><span>
</span><span id="line-197"></span><span class="hs-identifier">tPM_NONOTIFY</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span>
</span><span id="line-198"></span><span class="hs-identifier">tPM_NONOTIFY</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">128</span><span>
</span><span id="line-199"></span><span class="hs-identifier">tPM_RETURNCMD</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span>
</span><span id="line-200"></span><span class="hs-identifier">tPM_RETURNCMD</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">256</span><span>
</span><span id="line-201"></span><span>
</span><span id="line-202"></span><span class="hs-pragma">{-# LINE 191 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-191"></span><span>
</span><span id="line-192"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-193"></span><span>
</span><span id="line-194"></span><span class="hs-identifier">sC_SIZE</span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-195"></span><span class="hs-identifier">sC_SIZE</span><span>               </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61440</span><span>
</span><span id="line-196"></span><span class="hs-identifier">sC_MOVE</span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-197"></span><span class="hs-identifier">sC_MOVE</span><span>               </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61456</span><span>
</span><span id="line-198"></span><span class="hs-identifier">sC_MINIMIZE</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-199"></span><span class="hs-identifier">sC_MINIMIZE</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61472</span><span>
</span><span id="line-200"></span><span class="hs-identifier">sC_MAXIMIZE</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-201"></span><span class="hs-identifier">sC_MAXIMIZE</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61488</span><span>
</span><span id="line-202"></span><span class="hs-identifier">sC_NEXTWINDOW</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-203"></span><span class="hs-identifier">sC_NEXTWINDOW</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61504</span><span>
</span><span id="line-204"></span><span class="hs-identifier">sC_PREVWINDOW</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-205"></span><span class="hs-identifier">sC_PREVWINDOW</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61520</span><span>
</span><span id="line-206"></span><span class="hs-identifier">sC_CLOSE</span><span>              </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-207"></span><span class="hs-identifier">sC_CLOSE</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61536</span><span>
</span><span id="line-208"></span><span class="hs-identifier">sC_VSCROLL</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-209"></span><span class="hs-identifier">sC_VSCROLL</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61552</span><span>
</span><span id="line-210"></span><span class="hs-identifier">sC_HSCROLL</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-211"></span><span class="hs-identifier">sC_HSCROLL</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61568</span><span>
</span><span id="line-212"></span><span class="hs-identifier">sC_MOUSEMENU</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-213"></span><span class="hs-identifier">sC_MOUSEMENU</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61584</span><span>
</span><span id="line-214"></span><span class="hs-identifier">sC_KEYMENU</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-215"></span><span class="hs-identifier">sC_KEYMENU</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61696</span><span>
</span><span id="line-216"></span><span class="hs-identifier">sC_ARRANGE</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-217"></span><span class="hs-identifier">sC_ARRANGE</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61712</span><span>
</span><span id="line-218"></span><span class="hs-identifier">sC_RESTORE</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-219"></span><span class="hs-identifier">sC_RESTORE</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61728</span><span>
</span><span id="line-220"></span><span class="hs-identifier">sC_TASKLIST</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-221"></span><span class="hs-identifier">sC_TASKLIST</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61744</span><span>
</span><span id="line-222"></span><span class="hs-identifier">sC_SCREENSAVE</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-223"></span><span class="hs-identifier">sC_SCREENSAVE</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61760</span><span>
</span><span id="line-224"></span><span class="hs-identifier">sC_HOTKEY</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-225"></span><span class="hs-identifier">sC_HOTKEY</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61776</span><span>
</span><span id="line-226"></span><span class="hs-identifier">sC_DEFAULT</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-227"></span><span class="hs-identifier">sC_DEFAULT</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61792</span><span>
</span><span id="line-228"></span><span class="hs-identifier">sC_MONITORPOWER</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-229"></span><span class="hs-identifier">sC_MONITORPOWER</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61808</span><span>
</span><span id="line-230"></span><span class="hs-identifier">sC_CONTEXTHELP</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-231"></span><span class="hs-identifier">sC_CONTEXTHELP</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61824</span><span>
</span><span id="line-232"></span><span class="hs-identifier">sC_SEPARATOR</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SystemMenuCommand</span><span>
</span><span id="line-233"></span><span class="hs-identifier">sC_SEPARATOR</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">61455</span><span>
</span><span id="line-234"></span><span>
</span><span id="line-235"></span><span class="hs-pragma">{-# LINE 216 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-216"></span><span>
</span><span id="line-217"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h IsMenu&quot;</span><span> </span><span class="hs-identifier">isMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-218"></span><span>
</span><span id="line-219"></span><span class="hs-identifier">getSystemMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HWND</span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span>     </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">HMENU</span><span class="hs-special">)</span><span>
</span><span id="line-220"></span><span class="hs-identifier">getSystemMenu</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-identifier">revert</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-221"></span><span>  </span><span class="hs-identifier">liftM</span><span> </span><span class="hs-identifier">ptrToMaybe</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GetSystemMenu</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-identifier">revert</span><span>
</span><span id="line-222"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetSystemMenu&quot;</span><span>
</span><span id="line-223"></span><span>  </span><span class="hs-identifier">c_GetSystemMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HWND</span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span>     </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HMENU</span><span>
</span><span id="line-224"></span><span>
</span><span id="line-225"></span><span class="hs-identifier">getMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HWND</span><span>  </span><span class="hs-glyph">-&gt;</span><span>             </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">HMENU</span><span class="hs-special">)</span><span>
</span><span id="line-226"></span><span class="hs-identifier">getMenu</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-227"></span><span>  </span><span class="hs-identifier">liftM</span><span> </span><span class="hs-identifier">ptrToMaybe</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GetMenu</span><span> </span><span class="hs-identifier">wnd</span><span>
</span><span id="line-228"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetMenu&quot;</span><span>
</span><span id="line-229"></span><span>  </span><span class="hs-identifier">c_GetMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HWND</span><span>  </span><span class="hs-glyph">-&gt;</span><span>             </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HMENU</span><span>
</span><span id="line-230"></span><span>
</span><span id="line-231"></span><span class="hs-identifier">getMenuDefaultItem</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">GMDIFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">MenuItem</span><span>
</span><span id="line-232"></span><span class="hs-identifier">getMenuDefaultItem</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">bypos</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-233"></span><span>  </span><span class="hs-identifier">failIf</span><span> </span><span class="hs-special">(</span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">maxBound</span><span class="hs-special">)</span><span> </span><span class="hs-string">&quot;GetMenuDefaultItem&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GetMenuDefaultItem</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">bypos</span><span> </span><span class="hs-identifier">flags</span><span>
</span><span id="line-234"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetMenuDefaultItem&quot;</span><span>
</span><span id="line-235"></span><span>  </span><span class="hs-identifier">c_GetMenuDefaultItem</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-236"></span><span>
</span><span id="line-237"></span><span class="hs-identifier">getMenuState</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">MenuState</span><span>
</span><span id="line-238"></span><span class="hs-identifier">getMenuState</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-239"></span><span>  </span><span class="hs-identifier">failIf</span><span> </span><span class="hs-special">(</span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">maxBound</span><span class="hs-special">)</span><span> </span><span class="hs-string">&quot;GetMenuState&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GetMenuState</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">flags</span><span>
</span><span id="line-240"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetMenuState&quot;</span><span>
</span><span id="line-241"></span><span>  </span><span class="hs-identifier">c_GetMenuState</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">MenuState</span><span>
</span><span id="line-242"></span><span>
</span><span id="line-243"></span><span class="hs-identifier">getSubMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">HMENU</span><span class="hs-special">)</span><span>
</span><span id="line-244"></span><span class="hs-identifier">getSubMenu</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">pos</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-245"></span><span>  </span><span class="hs-identifier">liftM</span><span> </span><span class="hs-identifier">ptrToMaybe</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GetSubMenu</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">pos</span><span>
</span><span id="line-246"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetSubMenu&quot;</span><span>
</span><span id="line-247"></span><span>  </span><span class="hs-identifier">c_GetSubMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HMENU</span><span>
</span><span id="line-248"></span><span>
</span><span id="line-249"></span><span class="hs-identifier">setMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-250"></span><span class="hs-identifier">setMenu</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-251"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;SetMenu&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_SetMenu</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-identifier">menu</span><span>
</span><span id="line-252"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h SetMenu&quot;</span><span>
</span><span id="line-253"></span><span>  </span><span class="hs-identifier">c_SetMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-254"></span><span>
</span><span id="line-255"></span><span class="hs-identifier">getMenuItemCount</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Int</span><span>
</span><span id="line-256"></span><span class="hs-identifier">getMenuItemCount</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-257"></span><span>  </span><span class="hs-identifier">failIf</span><span> </span><span class="hs-special">(</span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">maxBound</span><span class="hs-special">)</span><span> </span><span class="hs-string">&quot;GetMenuItemCount&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GetMenuItemCount</span><span> </span><span class="hs-identifier">menu</span><span>
</span><span id="line-258"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetMenuItemCount&quot;</span><span>
</span><span id="line-259"></span><span>  </span><span class="hs-identifier">c_GetMenuItemCount</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Int</span><span>
</span><span id="line-260"></span><span>
</span><span id="line-261"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">MenuID</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-262"></span><span>
</span><span id="line-263"></span><span class="hs-identifier">getMenuItemID</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">MenuID</span><span>
</span><span id="line-264"></span><span class="hs-identifier">getMenuItemID</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-265"></span><span>  </span><span class="hs-identifier">failIf</span><span> </span><span class="hs-special">(</span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">maxBound</span><span class="hs-special">)</span><span> </span><span class="hs-string">&quot;GetMenuItemID&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GetMenuItemID</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span>
</span><span id="line-266"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetMenuItemID&quot;</span><span>
</span><span id="line-267"></span><span>  </span><span class="hs-identifier">c_GetMenuItemID</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">MenuID</span><span>
</span><span id="line-268"></span><span>
</span><span id="line-269"></span><span class="hs-keyword">data</span><span> </span><span class="hs-identifier">MenuItemInfo</span><span>
</span><span id="line-270"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">MenuItemInfo</span><span>  </span><span class="hs-special">{</span><span>
</span><span id="line-271"></span><span>      </span><span class="hs-identifier">menuItemType</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuFlag</span><span class="hs-special">,</span><span>
</span><span id="line-272"></span><span>      </span><span class="hs-identifier">menuItemState</span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuState</span><span class="hs-special">,</span><span>
</span><span id="line-273"></span><span>      </span><span class="hs-identifier">menuItemID</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">UINT</span><span class="hs-special">,</span><span>
</span><span id="line-274"></span><span>      </span><span class="hs-identifier">menuItemSubMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span class="hs-special">,</span><span>
</span><span id="line-275"></span><span>      </span><span class="hs-identifier">menuItemBitmapChecked</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HBITMAP</span><span class="hs-special">,</span><span>
</span><span id="line-276"></span><span>      </span><span class="hs-identifier">menuItemBitmapUnchecked</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HBITMAP</span><span class="hs-special">,</span><span>
</span><span id="line-277"></span><span>      </span><span class="hs-identifier">menuItemData</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DWORD</span><span class="hs-special">,</span><span>
</span><span id="line-278"></span><span>      </span><span class="hs-identifier">menuItemTypeData</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span>
</span><span id="line-279"></span><span>   </span><span class="hs-special">}</span><span>
</span><span id="line-280"></span><span>
</span><span id="line-281"></span><span class="hs-comment">-- Don't make this an instance of Storable, because poke isn't what we want.</span><span>
</span><span id="line-282"></span><span>
</span><span id="line-283"></span><span class="hs-identifier">peekMenuItemInfo</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">MenuItemInfo</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">MenuItemInfo</span><span>
</span><span id="line-284"></span><span class="hs-identifier">peekMenuItemInfo</span><span> </span><span class="hs-identifier">p</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-285"></span><span>  </span><span class="hs-identifier">itemType</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">8</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span>
</span><span id="line-286"></span><span class="hs-pragma">{-# LINE 286 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-286"></span><span>  </span><span class="hs-identifier">itemState</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">12</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span>
</span><span id="line-287"></span><span class="hs-pragma">{-# LINE 287 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-287"></span><span>  </span><span class="hs-identifier">itemID</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">16</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span>
</span><span id="line-288"></span><span class="hs-pragma">{-# LINE 288 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-288"></span><span>  </span><span class="hs-identifier">itemSubMenu</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">24</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span>
</span><span id="line-289"></span><span class="hs-pragma">{-# LINE 289 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-289"></span><span>  </span><span class="hs-identifier">itemBitmapChecked</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">32</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span>
</span><span id="line-290"></span><span class="hs-pragma">{-# LINE 290 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-290"></span><span>  </span><span class="hs-identifier">itemBitmapUnchecked</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">40</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span>
</span><span id="line-291"></span><span class="hs-pragma">{-# LINE 291 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-291"></span><span>  </span><span class="hs-identifier">itemData</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">48</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span>
</span><span id="line-292"></span><span class="hs-pragma">{-# LINE 292 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-292"></span><span>  </span><span class="hs-identifier">nchars</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">64</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span>
</span><span id="line-293"></span><span class="hs-pragma">{-# LINE 293 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-293"></span><span>  </span><span class="hs-identifier">c_str</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">56</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span>
</span><span id="line-294"></span><span class="hs-pragma">{-# LINE 294 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-294"></span><span>  </span><span class="hs-identifier">itemTypeData</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peekTStringLen</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">c_str</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">nchars</span><span class="hs-glyph">::</span><span class="hs-identifier">UINT</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-295"></span><span>  </span><span class="hs-identifier">return</span><span> </span><span class="hs-identifier">MenuItemInfo</span><span>
</span><span id="line-296"></span><span>    </span><span class="hs-special">{</span><span> </span><span class="hs-identifier">menuItemType</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">itemType</span><span>
</span><span id="line-297"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">menuItemState</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">itemState</span><span>
</span><span id="line-298"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">menuItemID</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">itemID</span><span>
</span><span id="line-299"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">menuItemSubMenu</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">itemSubMenu</span><span>
</span><span id="line-300"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">menuItemBitmapChecked</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">itemBitmapChecked</span><span>
</span><span id="line-301"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">menuItemBitmapUnchecked</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">itemBitmapUnchecked</span><span>
</span><span id="line-302"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">menuItemData</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">itemData</span><span>
</span><span id="line-303"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">menuItemTypeData</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">itemTypeData</span><span>
</span><span id="line-304"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-305"></span><span>
</span><span id="line-306"></span><span class="hs-identifier">allocaMenuItemInfo</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">MenuItemInfo</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span>
</span><span id="line-307"></span><span class="hs-identifier">allocaMenuItemInfo</span><span> </span><span class="hs-identifier">f</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-308"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-number">80</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">in</span><span>
</span><span id="line-309"></span><span class="hs-pragma">{-# LINE 309 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-309"></span><span>  </span><span class="hs-identifier">allocaBytes</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-310"></span><span>  </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">size</span><span class="hs-glyph">::</span><span class="hs-identifier">DWORD</span><span class="hs-special">)</span><span>
</span><span id="line-311"></span><span class="hs-pragma">{-# LINE 311 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-311"></span><span>  </span><span class="hs-identifier">f</span><span> </span><span class="hs-identifier">p</span><span>
</span><span id="line-312"></span><span>
</span><span id="line-313"></span><span class="hs-identifier">withMenuItemInfo</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItemInfo</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">MenuItemInfo</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span>
</span><span id="line-314"></span><span class="hs-identifier">withMenuItemInfo</span><span> </span><span class="hs-identifier">info</span><span> </span><span class="hs-identifier">f</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-315"></span><span>  </span><span class="hs-identifier">allocaMenuItemInfo</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-316"></span><span>  </span><span class="hs-identifier">withTStringLen</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">menuItemTypeData</span><span> </span><span class="hs-identifier">info</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">c_str</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">nchars</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-317"></span><span>  </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">8</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">menuItemType</span><span> </span><span class="hs-identifier">info</span><span class="hs-special">)</span><span>
</span><span id="line-318"></span><span class="hs-pragma">{-# LINE 318 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-318"></span><span>  </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">12</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">menuItemState</span><span> </span><span class="hs-identifier">info</span><span class="hs-special">)</span><span>
</span><span id="line-319"></span><span class="hs-pragma">{-# LINE 319 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-319"></span><span>  </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">16</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">menuItemID</span><span> </span><span class="hs-identifier">info</span><span class="hs-special">)</span><span>
</span><span id="line-320"></span><span class="hs-pragma">{-# LINE 320 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-320"></span><span>  </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">24</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">menuItemSubMenu</span><span> </span><span class="hs-identifier">info</span><span class="hs-special">)</span><span>
</span><span id="line-321"></span><span class="hs-pragma">{-# LINE 321 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-321"></span><span>  </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">32</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">menuItemBitmapChecked</span><span> </span><span class="hs-identifier">info</span><span class="hs-special">)</span><span>
</span><span id="line-322"></span><span class="hs-pragma">{-# LINE 322 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-322"></span><span>  </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">40</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">menuItemBitmapUnchecked</span><span> </span><span class="hs-identifier">info</span><span class="hs-special">)</span><span>
</span><span id="line-323"></span><span class="hs-pragma">{-# LINE 323 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-323"></span><span>  </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">48</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span> </span><span class="hs-identifier">c_str</span><span>
</span><span id="line-324"></span><span class="hs-pragma">{-# LINE 324 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-324"></span><span>  </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">64</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">nchars</span><span class="hs-glyph">::</span><span class="hs-identifier">UINT</span><span class="hs-special">)</span><span>
</span><span id="line-325"></span><span class="hs-pragma">{-# LINE 325 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-325"></span><span>  </span><span class="hs-identifier">f</span><span> </span><span class="hs-identifier">p</span><span>
</span><span id="line-326"></span><span>
</span><span id="line-327"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">MenuItemMask</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-328"></span><span>
</span><span id="line-329"></span><span class="hs-identifier">mIIM_CHECKMARKS</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItemMask</span><span>
</span><span id="line-330"></span><span class="hs-identifier">mIIM_CHECKMARKS</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8</span><span>
</span><span id="line-331"></span><span class="hs-identifier">mIIM_DATA</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItemMask</span><span>
</span><span id="line-332"></span><span class="hs-identifier">mIIM_DATA</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">32</span><span>
</span><span id="line-333"></span><span class="hs-identifier">mIIM_ID</span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItemMask</span><span>
</span><span id="line-334"></span><span class="hs-identifier">mIIM_ID</span><span>               </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-335"></span><span class="hs-identifier">mIIM_STATE</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItemMask</span><span>
</span><span id="line-336"></span><span class="hs-identifier">mIIM_STATE</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-337"></span><span class="hs-identifier">mIIM_SUBMENU</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItemMask</span><span>
</span><span id="line-338"></span><span class="hs-identifier">mIIM_SUBMENU</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-339"></span><span class="hs-identifier">mIIM_TYPE</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MenuItemMask</span><span>
</span><span id="line-340"></span><span class="hs-identifier">mIIM_TYPE</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16</span><span>
</span><span id="line-341"></span><span>
</span><span id="line-342"></span><span class="hs-pragma">{-# LINE 337 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-337"></span><span>
</span><span id="line-338"></span><span class="hs-identifier">pokeFMask</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">MenuItemInfo</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItemMask</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-339"></span><span class="hs-identifier">pokeFMask</span><span> </span><span class="hs-identifier">p_info</span><span> </span><span class="hs-identifier">mask</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-340"></span><span>  </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">4</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p_info</span><span> </span><span class="hs-identifier">mask</span><span>
</span><span id="line-341"></span><span class="hs-pragma">{-# LINE 341 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-341"></span><span>
</span><span id="line-342"></span><span class="hs-identifier">getMenuItemInfo</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItemMask</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">MenuItemInfo</span><span>
</span><span id="line-343"></span><span class="hs-identifier">getMenuItemInfo</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">bypos</span><span> </span><span class="hs-identifier">mask</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-344"></span><span>  </span><span class="hs-identifier">allocaMenuItemInfo</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_info</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-345"></span><span>  </span><span class="hs-identifier">pokeFMask</span><span> </span><span class="hs-identifier">p_info</span><span> </span><span class="hs-identifier">mask</span><span>
</span><span id="line-346"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;GetMenuItemInfo&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GetMenuItemInfo</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">bypos</span><span> </span><span class="hs-identifier">p_info</span><span>
</span><span id="line-347"></span><span>  </span><span class="hs-identifier">peekMenuItemInfo</span><span> </span><span class="hs-identifier">p_info</span><span>
</span><span id="line-348"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetMenuItemInfoW&quot;</span><span>
</span><span id="line-349"></span><span>  </span><span class="hs-identifier">c_GetMenuItemInfo</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">MenuItemInfo</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-350"></span><span>
</span><span id="line-351"></span><span class="hs-identifier">getMenuItemRect</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">RECT</span><span>
</span><span id="line-352"></span><span class="hs-identifier">getMenuItemRect</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-353"></span><span>  </span><span class="hs-identifier">allocaRECT</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_rect</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-354"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;GetMenuItemRect&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GetMenuItemRect</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">p_rect</span><span>
</span><span id="line-355"></span><span>  </span><span class="hs-identifier">peekRECT</span><span> </span><span class="hs-identifier">p_rect</span><span>
</span><span id="line-356"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetMenuItemRect&quot;</span><span>
</span><span id="line-357"></span><span>  </span><span class="hs-identifier">c_GetMenuItemRect</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPRECT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-358"></span><span>
</span><span id="line-359"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h HiliteMenuItem&quot;</span><span>
</span><span id="line-360"></span><span>  </span><span class="hs-identifier">hiliteMenuItem</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HWND</span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-361"></span><span>
</span><span id="line-362"></span><span class="hs-identifier">insertMenuItem</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItemInfo</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-363"></span><span class="hs-identifier">insertMenuItem</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">bypos</span><span> </span><span class="hs-identifier">info</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-364"></span><span>  </span><span class="hs-identifier">withMenuItemInfo</span><span> </span><span class="hs-identifier">info</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_info</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-365"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;InsertMenuItem&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_InsertMenuItem</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">bypos</span><span> </span><span class="hs-identifier">p_info</span><span>
</span><span id="line-366"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h InsertMenuItemW&quot;</span><span>
</span><span id="line-367"></span><span>  </span><span class="hs-identifier">c_InsertMenuItem</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">MenuItemInfo</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-368"></span><span>
</span><span id="line-369"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">Menu</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">LPCTSTR</span><span>
</span><span id="line-370"></span><span class="hs-comment">-- intToMenu :: Int -&gt; Menu</span><span>
</span><span id="line-371"></span><span class="hs-comment">-- intToMenu i = makeIntResource (toWord i)</span><span>
</span><span id="line-372"></span><span>
</span><span id="line-373"></span><span class="hs-identifier">loadMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">HINSTANCE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Menu</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HMENU</span><span>
</span><span id="line-374"></span><span class="hs-identifier">loadMenu</span><span> </span><span class="hs-identifier">mb_inst</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-375"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-string">&quot;LoadMenu&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_LoadMenu</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">mb_inst</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">menu</span><span>
</span><span id="line-376"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h LoadMenuW&quot;</span><span>
</span><span id="line-377"></span><span>  </span><span class="hs-identifier">c_LoadMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HINSTANCE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Menu</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HMENU</span><span>
</span><span id="line-378"></span><span>
</span><span id="line-379"></span><span class="hs-comment">-- Dealing with mappings to/from structs is a pain in GC,</span><span>
</span><span id="line-380"></span><span class="hs-comment">-- so we'll leave this one out for now.</span><span>
</span><span id="line-381"></span><span class="hs-comment">-- %fun LoadMenuIndirect :: MenuTemplate -&gt; IO HMENU</span><span>
</span><span id="line-382"></span><span>
</span><span id="line-383"></span><span class="hs-comment">-- Can't pass structs with current FFI, so use a C wrapper (from Types)</span><span>
</span><span id="line-384"></span><span class="hs-identifier">menuItemFromPoint</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">POINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-385"></span><span class="hs-identifier">menuItemFromPoint</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">pt</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-386"></span><span>  </span><span class="hs-identifier">withPOINT</span><span> </span><span class="hs-identifier">pt</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_pt</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-387"></span><span>  </span><span class="hs-identifier">prim_MenuItemFromPoint</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">p_pt</span><span>
</span><span id="line-388"></span><span>
</span><span id="line-389"></span><span class="hs-identifier">setMenuDefaultItem</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-390"></span><span class="hs-identifier">setMenuDefaultItem</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">bypos</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-391"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;SetMenuDefaultItem&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_SetMenuDefaultItem</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">bypos</span><span>
</span><span id="line-392"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h SetMenuDefaultItem&quot;</span><span>
</span><span id="line-393"></span><span>  </span><span class="hs-identifier">c_SetMenuDefaultItem</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-394"></span><span>
</span><span id="line-395"></span><span class="hs-identifier">setMenuItemBitmaps</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HBITMAP</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HBITMAP</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-396"></span><span class="hs-identifier">setMenuItemBitmaps</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">pos</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">bm_unchecked</span><span> </span><span class="hs-identifier">bm_checked</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-397"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;SetMenuItemBitmaps&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-398"></span><span>    </span><span class="hs-identifier">c_SetMenuItemBitmaps</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">pos</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">bm_unchecked</span><span> </span><span class="hs-identifier">bm_checked</span><span>
</span><span id="line-399"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h SetMenuItemBitmaps&quot;</span><span>
</span><span id="line-400"></span><span>  </span><span class="hs-identifier">c_SetMenuItemBitmaps</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HBITMAP</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HBITMAP</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-401"></span><span>
</span><span id="line-402"></span><span class="hs-identifier">destroyMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-403"></span><span class="hs-identifier">destroyMenu</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-404"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;DestroyMenu&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_DestroyMenu</span><span> </span><span class="hs-identifier">menu</span><span>
</span><span id="line-405"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h DestroyMenu&quot;</span><span>
</span><span id="line-406"></span><span>  </span><span class="hs-identifier">c_DestroyMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-407"></span><span>
</span><span id="line-408"></span><span class="hs-identifier">deleteMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-409"></span><span class="hs-identifier">deleteMenu</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">flag</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-410"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;DeleteMenu&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_DeleteMenu</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">flag</span><span>
</span><span id="line-411"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h DeleteMenu&quot;</span><span>
</span><span id="line-412"></span><span>  </span><span class="hs-identifier">c_DeleteMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-413"></span><span>
</span><span id="line-414"></span><span class="hs-identifier">setMenuItemInfo</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItemMask</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItemInfo</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-415"></span><span class="hs-identifier">setMenuItemInfo</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">bypos</span><span> </span><span class="hs-identifier">mask</span><span> </span><span class="hs-identifier">info</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-416"></span><span>  </span><span class="hs-identifier">withMenuItemInfo</span><span> </span><span class="hs-identifier">info</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_info</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-417"></span><span>  </span><span class="hs-identifier">pokeFMask</span><span> </span><span class="hs-identifier">p_info</span><span> </span><span class="hs-identifier">mask</span><span>
</span><span id="line-418"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;SetMenuItemInfo&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_SetMenuItemInfo</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">bypos</span><span> </span><span class="hs-identifier">p_info</span><span>
</span><span id="line-419"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h SetMenuItemInfoW&quot;</span><span>
</span><span id="line-420"></span><span>  </span><span class="hs-identifier">c_SetMenuItemInfo</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">MenuItemInfo</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-421"></span><span>
</span><span id="line-422"></span><span class="hs-identifier">trackPopupMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">RECT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-423"></span><span class="hs-identifier">trackPopupMenu</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-identifier">y</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-identifier">rect</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-424"></span><span>  </span><span class="hs-identifier">withRECT</span><span> </span><span class="hs-identifier">rect</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_rect</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-425"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;TrackPopupMenu&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_TrackPopupMenu</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-identifier">y</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-identifier">p_rect</span><span>
</span><span id="line-426"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h TrackPopupMenu&quot;</span><span>
</span><span id="line-427"></span><span>  </span><span class="hs-identifier">c_TrackPopupMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPRECT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-428"></span><span>
</span><span id="line-429"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">TPMPARAMS</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-430"></span><span>
</span><span id="line-431"></span><span class="hs-identifier">withTPMPARAMS</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">RECT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">TPMPARAMS</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span>
</span><span id="line-432"></span><span class="hs-identifier">withTPMPARAMS</span><span> </span><span class="hs-identifier">p_rect</span><span> </span><span class="hs-identifier">f</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-433"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-number">20</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">in</span><span>
</span><span id="line-434"></span><span class="hs-pragma">{-# LINE 434 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-434"></span><span>  </span><span class="hs-identifier">allocaBytes</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-435"></span><span>  </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">size</span><span class="hs-glyph">::</span><span class="hs-identifier">UINT</span><span class="hs-special">)</span><span>
</span><span id="line-436"></span><span class="hs-pragma">{-# LINE 436 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-436"></span><span>  </span><span class="hs-identifier">copyBytes</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">plusPtr</span><span class="hs-special">`</span><span> </span><span class="hs-number">4</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p_rect</span><span> </span><span class="hs-identifier">size</span><span>
</span><span id="line-437"></span><span class="hs-pragma">{-# LINE 437 &quot;libraries\\Win32\\Graphics\\Win32\\Menu.hsc&quot; #-}</span><span>
</span><span id="line-437"></span><span>  </span><span class="hs-identifier">f</span><span> </span><span class="hs-identifier">p</span><span>
</span><span id="line-438"></span><span>
</span><span id="line-439"></span><span class="hs-identifier">trackPopupMenuEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">RECT</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-440"></span><span class="hs-identifier">trackPopupMenuEx</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-identifier">y</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-identifier">mb_p_rect</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-441"></span><span>  </span><span class="hs-identifier">maybeWith</span><span> </span><span class="hs-identifier">withTPMPARAMS</span><span> </span><span class="hs-identifier">mb_p_rect</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_ptmp</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-442"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;TrackPopupMenuEx&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_TrackPopupMenuEx</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-identifier">y</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-identifier">p_ptmp</span><span>
</span><span id="line-443"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h TrackPopupMenuEx&quot;</span><span>
</span><span id="line-444"></span><span>  </span><span class="hs-identifier">c_TrackPopupMenuEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">TrackMenuFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">TPMPARAMS</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-445"></span><span>
</span><span id="line-446"></span><span class="hs-comment">-- Note: these 3 assume the flags don't include MF_BITMAP or MF_OWNERDRAW</span><span>
</span><span id="line-447"></span><span class="hs-comment">-- (which are hidden by this interface)</span><span>
</span><span id="line-448"></span><span>
</span><span id="line-449"></span><span class="hs-identifier">appendMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuID</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-450"></span><span class="hs-identifier">appendMenu</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">id_item</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-451"></span><span>  </span><span class="hs-identifier">maybeWith</span><span> </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-452"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;AppendMenu&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_AppendMenu</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">id_item</span><span> </span><span class="hs-identifier">c_name</span><span>
</span><span id="line-453"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h AppendMenuW&quot;</span><span>
</span><span id="line-454"></span><span>  </span><span class="hs-identifier">c_AppendMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuID</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-455"></span><span>
</span><span id="line-456"></span><span class="hs-identifier">insertMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuID</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-457"></span><span class="hs-identifier">insertMenu</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">id_item</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-458"></span><span>  </span><span class="hs-identifier">maybeWith</span><span> </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-459"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;InsertMenu&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_InsertMenu</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">id_item</span><span> </span><span class="hs-identifier">c_name</span><span>
</span><span id="line-460"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h InsertMenuW&quot;</span><span>
</span><span id="line-461"></span><span>  </span><span class="hs-identifier">c_InsertMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuID</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-462"></span><span>
</span><span id="line-463"></span><span class="hs-identifier">modifyMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuID</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-464"></span><span class="hs-identifier">modifyMenu</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">id_item</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-465"></span><span>  </span><span class="hs-identifier">maybeWith</span><span> </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-466"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;ModifyMenu&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_ModifyMenu</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">item</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">id_item</span><span> </span><span class="hs-identifier">c_name</span><span>
</span><span id="line-467"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h ModifyMenuW&quot;</span><span>
</span><span id="line-468"></span><span>  </span><span class="hs-identifier">c_ModifyMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuID</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-469"></span><span>
</span><span id="line-470"></span><span class="hs-identifier">removeMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuItem</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MenuFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-471"></span><span class="hs-identifier">removeMenu</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">pos</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-472"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;RemoveMenu&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_RemoveMenu</span><span> </span><span class="hs-identifier">menu</span><span> </span><span class="hs-identifier">pos</span><span> </span><span class="hs-identifier">flags</span><span>
</span><span id="line-473"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RemoveMenu&quot;</span><span>
</span><span id="line-474"></span><span>  </span><span class="hs-identifier">c_RemoveMenu</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HMENU</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-475"></span><span>
</span><span id="line-476"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-477"></span><span class="hs-comment">-- End</span><span>
</span><span id="line-478"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-479"></span></pre></body></html>